<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Language binding</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Language_binding"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Language_binding rootpage-Language_binding skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Language binding</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p>In <a href="Computer_programming" title="Computer programming">programming</a> and <a href="Software_design" title="Software design">software design</a>, a <b>binding</b> is an <a href="Application_programming_interface" class="mw-redirect" title="Application programming interface">application programming interface</a> (API) that provides <a href="Glue_code" title="Glue code">glue code</a> specifically made to allow a <a href="Programming_language" title="Programming language">programming language</a> to use a foreign <a href="Library_(computer_science)" class="mw-redirect" title="Library (computer science)">library</a> or <a href="Operating_system" title="Operating system">operating system</a> service (one that is not native to that language).
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Characteristics">Characteristics</h2></div>
<p>Binding generally refers to a mapping of one thing to another. In the context of <a href="Library_(computing)" title="Library (computing)">software libraries</a>, bindings are <a href="Wrapper_library" title="Wrapper library">wrapper libraries</a> that bridge two <a href="Programming_language" title="Programming language">programming languages</a>, so that a <a href="Library_(computing)" title="Library (computing)">library</a> written for one language can be used in another language.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> Many software libraries are written in <a href="System_programming_language" title="System programming language">system programming languages</a> such as <a href="C_(programming_language)" title="C (programming language)">C</a> or <a href="C%2B%2B" title="C++">C++</a>. To use such libraries from another language, usually of <a href="High-level_programming_language" title="High-level programming language">higher-level</a>, such as <a href="Java_(programming_language)" title="Java (programming language)">Java</a>, <a href="Common_Lisp" title="Common Lisp">Common Lisp</a>, <a href="Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a>, <a href="Python_(programming_language)" title="Python (programming language)">Python</a>, or <a href="Lua_(programming_language)" class="mw-redirect" title="Lua (programming language)">Lua</a>, a binding to the library must be created in that language, possibly requiring <a href="Compiler" title="Compiler">recompiling</a> the language's code, depending on the amount of modification needed.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> However, most languages offer a <a href="Foreign_function_interface" title="Foreign function interface">foreign function interface</a>, such as Python's and <a href="OCaml" title="OCaml">OCaml</a>'s <code>ctypes</code>, and <a href="Embeddable_Common_Lisp" title="Embeddable Common Lisp">Embeddable Common Lisp</a>'s <code>cffi</code> and <code>uffi</code>.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</p><p>For example, <a href="Python_(programming_language)" title="Python (programming language)">Python</a> bindings are used when an extant C library, written for some purpose, is to be used from Python. Another example is <code>libsvn</code> which is written in C to provide an API to access the <a href="Apache_Subversion" title="Apache Subversion">Subversion</a> <a href="Software_repository" title="Software repository">software repository</a>. To access Subversion from within Java code, <code>libsvnjavahl</code> can be used, which depends on <code>libsvn</code> being installed and acts as a bridge between the language Java and <code>libsvn</code>, thus providing an API that invokes functions from <code>libsvn</code> to do the work.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p><p>Major motives to create library bindings include <a href="Software_reuse" class="mw-redirect" title="Software reuse">software reuse</a>, to reduce reimplementing a library in several languages, and the difficulty of implementing some <a href="Algorithm" title="Algorithm">algorithms</a> efficiently in some high-level languages.
</p>
<div class="mw-heading mw-heading2"><h2 id="Runtime_environment">Runtime environment</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */
.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}
/* end https://en.wikipedia.org/ */
</style>
<div class="mw-heading mw-heading3"><h3 id="Object_models">Object models</h3></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">Further information: <a href="Object_model" title="Object model">Object model</a></div>
<ul><li><a href="Common_Object_Request_Broker_Architecture" title="Common Object Request Broker Architecture">Common Object Request Broker Architecture</a> (CORBA) – <a href="Cross-platform" class="mw-redirect" title="Cross-platform">cross-platform</a>-language model</li>
<li><a href="Component_Object_Model" title="Component Object Model">Component Object Model</a> (COM) – <a href="Microsoft_Windows" title="Microsoft Windows">Microsoft Windows</a> only cross-language model
<ul><li><a href="Distributed_Component_Object_Model" title="Distributed Component Object Model">Distributed Component Object Model</a> (DCOM) – extension enabling COM to work over networks</li>
<li>Cross Platform Component Object Model (<a href="XPCOM" title="XPCOM">XPCOM</a>) – Mozilla applications <a href="Cross-platform" class="mw-redirect" title="Cross-platform">cross-platform</a> model</li></ul></li>
<li><a href="Common_Language_Infrastructure" title="Common Language Infrastructure">Common Language Infrastructure</a> – <a href=".NET_Framework" title=".NET Framework">.NET Framework</a> <a href="Cross-platform" class="mw-redirect" title="Cross-platform">cross-platform</a>-language model</li>
<li><a href="Freedesktop.org" title="Freedesktop.org">Freedesktop.org</a> <a href="D-Bus" title="D-Bus">D-Bus</a> – open <a href="Cross-platform" class="mw-redirect" title="Cross-platform">cross-platform</a>-language model</li></ul>
<div class="mw-heading mw-heading3"><h3 id="Virtual_machines">Virtual machines</h3></div>
<div role="note" class="hatnote navigation-not-searchable">Further information: <a href="Virtual_machine" title="Virtual machine">Virtual machine</a></div>
<ul><li><a href="Comparison_of_application_virtual_machines" class="mw-redirect" title="Comparison of application virtual machines">Comparison of application virtual machines</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Porting">Porting</h2></div>
<div role="note" class="hatnote navigation-not-searchable">Further information: <a href="Porting" title="Porting">Porting</a></div>
<ul><li><a href="Portable_object_(computing)" title="Portable object (computing)">Portable object</a> – <a href="Cross-platform" class="mw-redirect" title="Cross-platform">cross-platform</a>-language object model definition</li></ul>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1266661725">
/* start https://en.wikipedia.org/ */
.mw-parser-output .portalbox{padding:0;margin:0.5em 0;display:table;box-sizing:border-box;max-width:175px;list-style:none}.mw-parser-output .portalborder{border:1px solid var(--border-color-base,#a2a9b1);padding:0.1em;background:var(--background-color-neutral-subtle,#f8f9fa)}.mw-parser-output .portalbox-entry{display:table-row;font-size:85%;line-height:110%;height:1.9em;font-style:italic;font-weight:bold}.mw-parser-output .portalbox-image{display:table-cell;padding:0.2em;vertical-align:middle;text-align:center}.mw-parser-output .portalbox-link{display:table-cell;padding:0.2em 0.2em 0.2em 0.3em;vertical-align:middle}@media(min-width:720px){.mw-parser-output .portalleft{margin:0.5em 1em 0.5em 0}.mw-parser-output .portalright{clear:right;float:right;margin:0.5em 0 0.5em 1em}}
/* end https://en.wikipedia.org/ */
</style>
<style data-mw-deduplicate="TemplateStyles:r1184024115">
/* start https://en.wikipedia.org/ */
.mw-parser-output .div-col{margin-top:0.3em;column-width:30em}.mw-parser-output .div-col-small{font-size:90%}.mw-parser-output .div-col-rules{column-rule:1px solid #aaa}.mw-parser-output .div-col dl,.mw-parser-output .div-col ol,.mw-parser-output .div-col ul{margin-top:0}.mw-parser-output .div-col li,.mw-parser-output .div-col dd{page-break-inside:avoid;break-inside:avoid-column}
/* end https://en.wikipedia.org/ */
</style><div class="div-col" style="column-width: 50em;">
<ul><li><a href="Application_programming_interface" class="mw-redirect" title="Application programming interface">Application programming interface</a> (API)</li>
<li><a href="Application_binary_interface" title="Application binary interface">Application binary interface</a> (ABI)</li>
<li><a href="Calling_convention" title="Calling convention">Calling convention</a></li>
<li><a href="Embedded_SQL" title="Embedded SQL">Embedded SQL</a></li>
<li><a href="Name_mangling" title="Name mangling">Name mangling</a></li>
<li>Simplified Wrapper and Interface Generator (<a href="SWIG" title="SWIG">SWIG</a>) – interface binding generator from many languages to many languages, open-source</li>
<li><a href="Wrapper_function" title="Wrapper function">Wrapper function</a></li></ul>
</div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist reflist-columns references-column-width" style="column-width: 30em;">
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.cairographics.org/manual/language-bindings.html">"Appendix A. Creating a language binding for cairo"</a>. Cairographics.org<span class="reference-accessdate">. Retrieved <span class="nowrap">2014-04-02</span></span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20150116081559/http://www.acm.org/tsc/apis.html">"Standards, APIs, Interfaces and Bindings"</a>. Acm.org. Archived from <a rel="nofollow" class="external text" href="http://www.acm.org/tsc/apis.html">the original</a> on 2015-01-16<span class="reference-accessdate">. Retrieved <span class="nowrap">2014-04-02</span></span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.python.org/3/library/ctypes.html">"ctypes – A foreign function library for Python"</a>. <i>Python v3.8.3 documentation</i>. Docs.python.org<span class="reference-accessdate">. Retrieved <span class="nowrap">2020-06-04</span></span>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite id="CITEREFHickeyMadhavapeddyMinsky2013" class="citation web cs1">Hickey, Jason; Madhavapeddy, Anil; Minsky, Yaron (2013). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20150718235806/https://realworldocaml.org/v1/en/html/foreign-function-interface.html">"Real Worl OCaml, Chapter 19. Foreign Function Interface"</a>. <i>realworldocaml.org</i>. Archived from <a rel="nofollow" class="external text" href="https://realworldocaml.org/v1/en/html/foreign-function-interface.html">the original</a> on 2015-07-18<span class="reference-accessdate">. Retrieved <span class="nowrap">2015-07-19</span></span>.</cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://common-lisp.net/project/cffi/manual/html_node/Introduction.html#Introduction">"Introduction – CFFI User Manual"</a>. Common-lisp.net<span class="reference-accessdate">. Retrieved <span class="nowrap">2014-04-02</span></span>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20141227185536/http://subclipse.tigris.org/wiki/JavaHL">"Subversion JavaHL FAQ"</a>. Subclipse.tigris.org. 2013-06-18. Archived from <a rel="nofollow" class="external text" href="http://subclipse.tigris.org/wiki/JavaHL">the original</a> on 2014-12-27<span class="reference-accessdate">. Retrieved <span class="nowrap">2014-04-02</span></span>.</cite></span>
</li>
</ol></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://www.open-std.org/JTC1/SC22/WG11/">JTC1/SC22/WG11 - Binding Techniques</a>, an ISO standard for language bindings</li>
<li><a rel="nofollow" class="external text" href="https://stackoverflow.com/questions/25865/what-is-a-language-binding">What is a language binding?</a></li></ul>
<p><br>
</p>
<style data-mw-deduplicate="TemplateStyles:r1271159938">
/* start https://en.wikipedia.org/ */
.mw-parser-output .asbox{position:relative;overflow:hidden}.mw-parser-output .asbox table{background:transparent}.mw-parser-output .asbox p{margin:0}.mw-parser-output .asbox p+p{margin-top:0.25em}.mw-parser-output .asbox-body{font-style:italic}.mw-parser-output .asbox-note{font-size:smaller}.mw-parser-output .asbox .navbar{position:absolute;top:-0.75em;right:1em;display:none}.mw-parser-output :not(p):not(.asbox)+style+.asbox,.mw-parser-output :not(p):not(.asbox)+link+.asbox{margin-top:3em}
/* end https://en.wikipedia.org/ */
</style></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-30" href="https://en.wikipedia.org/wiki/?title=Language_binding&oldid=1303328366">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>